﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LingDong.QueryCore;

public partial class Index : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        TxtQuery.Focus();
    }

    protected void ObjectDataSourceResult_DataBinding(object sender, EventArgs e)
    {
        
    }

    protected void ObjectDataSourceResult_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        int resultCount = (e.ReturnValue as List<QueryResultEntity>).Count;
        if (resultCount == 0)
        {
            LabResultSummary.Text = "";
            return;
        }

        TimeSpan timeUsed = DateTime.Now - searchStartTime;
        LabResultSummary.Text = String.Format("找到 {0} 条结果，用时 {1} 秒",
                                                resultCount, timeUsed.TotalMilliseconds / 1000);
    }

    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        searchStartTime = DateTime.Now;
    }

    private DateTime searchStartTime;
}